package com.ls.controller.orderrecord;

import com.alibaba.fastjson.JSON;
import com.ls.controller.customer.model.TimeModel;
import com.ls.controller.orderrecord.model.OrderRefundModel;
import com.ls.controller.orderrecord.model.QueryOrderRecordModel;
import com.ls.controller.template.model.QueryTemplateModel;
import com.ls.service.IOrderRecordService;
import com.ls.service.ISmsTemplateService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @ClassName OrderRecordController
 * @Description 订单记录
 *
 * @author pengyu
 * @since 2024-06-28
 */
@Api(value = "订单记录", tags = "订单记录")
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/orderRecord")
public class OrderRecordController {
    private final IOrderRecordService service;
    /** 分页查询订单记录 */
    @GetMapping("pageList")
    public ResultData pageList(QueryOrderRecordModel model) {
        return service.pageList(model);
    }
    /** 退款 */
    @PostMapping("refund")
    public ResultData refund(@Valid @RequestBody OrderRefundModel model) {
        log.info("退款参数：{}", JSON.toJSONString(model));
        return service.refund(model.getOrderRecordId(),model.getMoney());
    }
    /** 统计信息充值产品  */
    @GetMapping(value = "getDataPay")
    public ResultData getDataPay(TimeModel model) {
        return service.getDataPay(model);
    }
    /** 统计会员充值趋势  */
    @GetMapping(value = "getDataRecharge")
    public ResultData getDataRecharge(TimeModel model) {
        return service.getDataRecharge(model);
    }
    /** 统计会员增长趋势  */
    @GetMapping(value = "getDataMember")
    public ResultData getDataMember(TimeModel model) {
        return service.getDataMember(model);
    }
}
